package com.qinyu.treehole.entities;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * R：用于存放前端要求的数据
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class R {
    private Object data;
    private int status;
    private String msg;

    public static R ok(Object data){
        return new R(data, 200, "一切正常");
    }

    public static R ok(Object data, String msg){
        return new R(data, 200, msg);
    }

    public static R no(Object data){
        return new R(data, 500, "出现异常");
    }

    public static R no(Object data, String msg){
        return new R(data, 500, msg);
    }

    public static R set(Object data, String msg, int status){
        return new R(data, status, msg);
    }
}
